package io.github.iogogogo.middleware;

import lombok.Data;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Created by tao.zeng on 2024/11/27.
 */
@Slf4j
@Setter
@SpringBootApplication
public class WebMiddlewareApplication implements CommandLineRunner {

    @Value("${spring.profiles.active}")
    private String profile;

    @Resource
    private TongWebLicense webLicense;

    public static void main(String[] args) {
        SpringApplication.run(WebMiddlewareApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        log.info("profile:{}", profile);
    }

    @Data
    @Component
    @ConfigurationProperties(prefix = "server.tongweb.license")
    public static class TongWebLicense {
        private String type;
        private String path;
    }
}
